<!DOCTYPE html>
<html lang="en" style="height:100%">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>帮助中心搜索</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css" />
    <!-- <link rel="stylesheet" href="../../css/BarlowCondensed-Bold.woff.ttf" /> -->
    <!-- <link rel="stylesheet" href="../../css/sqc.css"> -->
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        input{

            outline:none;
        }

    </style>
</head>

<body style="background: #fff;">

<div id="app"  v-cloak>
    <div class="help-top" style="background: #ffffff;">
        <div class="help-top-title">
            <div v-back.tapmode class="back"></div>
            <div class="title" style="color: #000">帮助中心</div>
        </div>
        <div class="search search-item" style="background-color: #F7F4F2;">
            <img src="../../image/small/1_search_1.png"/>
            <input class="search-input" type="text" v-model="value" placeholder="搜索问题关键词">
            <span class="sousuo" v-myclick="search">搜索</span>
        </div>
    </div>
    <div class="search_back_details">
        <div v-for="(list,index) in help_info" style="font-size: 15px;font-weight: bold;margin-bottom: 10px;" v-open-win="{id:list.id}" vurl="helpdetails">{{list.question_title}}</div>
    </div>
    <div class="search-history">
        <div style="width: 100%;height: 20px;margin-bottom: 20px;">
            <div style="float: left;font-size: 15px;font-weight: bold">搜索历史</div>
            <div style="float: right;font-size: 12px;color: #999;">
                <span style="vertical-align: middle" v-myclick="clear">清除记录</span>
                <img style="vertical-align: middle;width: 11px;height: 12px;" v-src="'../../image/shanchu.png'"/>
            </div>
        </div>
        <div class="search-history-title">
          <span v-for="(list,index) in history_title">{{list.search_title}}</span>
        </div>
    </div>
</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/components.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script>
    var vm,
        wx,
        history_title,
        help_info,
    apiready = function () {
        setBSImg();
        new Vue({
            el: '#blank'
        })
        wx = api.require('wx');
        var data = {
            member_id: getPrefs('member_id'),
        };
        var callback = function (ret) {
            history_title = ret.content;
            console.log(JSON.stringify(history_title));
            initApp();
        }
        pinet.post(APIURL + '/app/help/historyList', data, callback);
        api.parseTapmode();
    };

    function initApp() {
        // var isBigImg = Vue.BSImg == 'big';
        vm = new Vue({
            el: '#app',
            data: {
              value:'',
                history_title:history_title,
                help_info:help_info,
            },
            computed: {

            },
            methods: {
                search:function () {
                  var data = {
                    member_id:getPrefs('member_id'),
                    question_title:this.value,
                  };
                  var callback=function(ret){
                      vm.help_info = ret.content;
                      console.log(JSON.stringify(vm.help_info));
                      vm.reloder();
                  }

                  pinet.post(APIURL+'/app/help/helpSearch',data, callback);
                },
                reloder:function(){
                  var data = {
                      member_id: getPrefs('member_id'),
                  };
                  var callback = function (ret) {
                      vm.history_title = ret.content;
                      console.log(JSON.stringify(vm.history_title));
                  }
                  pinet.post(APIURL + '/app/help/historyList', data, callback);
                },
                clear:function(){
                  var data = {
                    member_id:getPrefs('member_id'),
                  };
                  var callback=function(ret){
                      api.toast({
                          msg: '删除成功',
                          duration: 2000,
                          location: 'middle'
                      });
                      vm.reloder();
                  }
                  pinet.post(APIURL+'/app/help/historyDelete',data, callback);
                },
            },
            watch: {

            },
        })
    }

</script>

</html>
